<?php
namespace Models\Model;

use Zend\Db\ResultSet\ResultSet;
use Zend\Db\TableGateway\TableGateway;
use Zend\Db\Sql;
use Zend\Db\Sql\Where;
use Zend\Db\Sql\Select;
use Zend\Paginator\Adapter\DbSelect;
use Zend\Paginator\Paginator;
use Zend\Db\Sql\Predicate;
use Zend\Db\Sql\Expression;

class ComplaintRelpiesTable
{
    protected $tableGateway;
	protected $select;
    public function __construct(TableGateway $tableGateway)
    {
        $this->tableGateway = $tableGateway;
		$this->select = new Select();
    }
	public function addReplyToComplaints($complaint_id,$data)
    {
		$data = array(
			'complaint_id' 				=> $complaint_id, 			
			'complaint_relpier_id'  	=> $data['shop_id'],  	
			'reply_text' 	 			=> $data['reply_text'],  
			'status'	 				=> 0, 				
			'date_added'	 			=> date('Y-m-d H:i:s'), 				
			'date_updated'	 			=> date('Y-m-d H:i:s'), 				
		);	
		$insertresult=$this->tableGateway->insert($data);	
		return $this->tableGateway->lastInsertValue;
    }	
	public function updateReplyOfComplaints($dataa){
	   $data = array(
			'reply_text'         =>$dataa['reply_text'],
	   );
	   $result=$this->tableGateway->update($data, array('complaint_relpies_id' => $dataa['complaint_relpies_id']));
	   return $result;                        
	}
}